ostree.git
9 years agorepo: Add archive/zlib-level option, drop default compression to 6
Colin Walters [Tue, 7 Feb 2017 13:59:32 +0000 (08:59 -0500)]
repo: Add archive/zlib-level option, drop default compression to 6

The gzip default is 6.  When I was writing this code, I chose 9 under
the assumption that for long-term archival, the extra compression was
worth it.

Turns out level 9 is really, really not worth it.  Here's run at level 9
compressing the current Fedora Atomic Host into archive:

```
ostree --repo=repo pull-local repo-build fedora-atomic/25/x86_64/docker-host
real    2m38.115s
user    2m31.210s
sys     0m3.114s
617M    repo
```

And here's the new default level of 6:

```
ostree --repo=repo pull-local repo-build fedora-atomic/25/x86_64/docker-host
real    0m53.712s
user    0m43.727s
sys     0m3.601s
619M    repo
619M    total
```

As you can see, we run almost *three times* faster, and we take up *less
than one percent* more space.

Conclusion: Using level 9 is dumb.  And here's a run at compression level 1:

```
ostree --repo=repo pull-local repo-build fedora-atomic/25/x86_64/docker-host
real    0m24.073s
user    0m17.574s
sys     0m2.636s
643M    repo
643M    total
```

I would argue actually many people would prefer even this for "devel" repos.
For production repos, you want static deltas anyways.  (However, perhaps
we should support a model where generating a delta involves re-compressing
fallback objects with a bit stronger compression level).

Anyways, let's make everyone's life better and switch the default to 6.

Closes: #671
Approved by: jlebon

9 years agorust: Support `make dist` -> cargo vendor
Colin Walters [Sat, 4 Feb 2017 16:29:20 +0000 (11:29 -0500)]
rust: Support `make dist` -> cargo vendor

What we do here basically is set things up in a `dist-hook` so that our Rust
sources are vendored at `dist` time. This gives us a single tarball still, and
ideally should be transparent to downstream builders, as long as they have the
`cargo/rust` toolchain.

Closes: #669
Approved by: jlebon

9 years agolib: Add ostree_repo_reload_config()
Colin Walters [Mon, 30 Jan 2017 06:43:37 +0000 (07:43 +0100)]
lib: Add ostree_repo_reload_config()

For a long time we've cached the remote configs in the repo, which
mostly makes sense for the `repo/config` file, but less sense
for `/etc/ostree/remotes.d`, because we want to support admins
interactively editing them.

One can delete the repo instance and create a new one, but that's a bit ugly.
Let's introduce an API for this so rpm-ostree can reload remotes after
admins/scripts edit them in `/etc`.  We also might as well reload
any other entries in the config.

Structurually now, `ostree_repo_open()` deals with file descriptors, and then
calls `ostree_repo_reload_config()`. Except for the uncompressed cache, which is
the only thing that deals with FDs that can be configured. But we want to delete
that anyways.

No tests, since...we don't have a daemon in this codebase, don't want to shave
that yak just today.

Closes: #662
Approved by: jlebon

9 years agopackaging/: Delete
Colin Walters [Sun, 5 Feb 2017 13:25:47 +0000 (08:25 -0500)]
packaging/: Delete

This is obsolete for a few reasons. The spec file is out of date (mostly the
%files, but also the BRs), and further down the line we'll need to use `make
dist` so we pick up vendored Rust sources. So the "git archive" approach won't
work for much longer anyways.

This came up in https://mail.gnome.org/archives/ostree-list/2017-February/msg00005.html

Basically, anyone who wants to build packages should look at the upstream
dist-git - until such time as e.g. Fedora learns to support pulling spec files
from upstream.

Closes: #670
Approved by: giuseppe

9 years agotrusted.gpg.d: keep in the same location
Jonathan Lebon [Fri, 3 Feb 2017 19:10:27 +0000 (14:10 -0500)]
trusted.gpg.d: keep in the same location

With the package rename from ostree to libostree, the trusted.gpg.d/ dir
changed install location from /usr/share/ostree to /usr/share/libostree.
Let's keep the same dir to remain compatible with existing installations
that may already have keys there.

Closes: #668
Approved by: cgwalters

9 years agodoc: fix typo in CONTRIBUTING
Chen Fan [Fri, 3 Feb 2017 07:03:06 +0000 (15:03 +0800)]
doc: fix typo in CONTRIBUTING

Signed-off-by: Chen Fan <fan.chen@easystack.cn>
Closes: #667
Approved by: cgwalters

9 years agooxidation: Add implementation of bupsplit in Rust
Colin Walters [Wed, 25 Jan 2017 02:43:53 +0000 (21:43 -0500)]
oxidation: Add implementation of bupsplit in Rust

This is an initial drop of "oxidation", or adding implementation
of components in Rust.  The bupsplit code is a good target - no
dependencies, just computation.

Translation into Rust had a few twists -

 - The C code relies a lot on overflowing unsigned ints, and
   also on the C promotion rules for e.g. `uint8_t -> int32_t`
 - There were some odd loops that I introduced bugs in while
   translating...in particular, the function always returns `len`,
   but I mistakenly translated to `len+1`, resulting in an OOB
   read on the C side, which was hard to debug.

On the plus side, an off-by-one array indexing in the Rust code paniced nicely.

In practice, we'll need a lot more build infrastructure to make this work, such
as using `cargo vendor` when producing build artifacts for example. Also, Cargo
is yet another thing we need to cache.

Where do we go with this? Well, I think we should merge this, it's not a lot of
code. We can just have it be an alternative CI target. Should we do a lot more
right now? Probably not immediately, but I find the medium/long term prospects
pretty exciting!

Closes: #656
Approved by: jlebon

9 years agoRename to libOSTree
Colin Walters [Mon, 30 Jan 2017 04:41:59 +0000 (05:41 +0100)]
Rename to libOSTree

There are many motivating factors. The biggest is simply that at a practical
level, the command line is not sufficient to build a real system. The docs say
that it's a demo for the library. Let's make that more obvious, so people don't
try to use `ostree admin upgrade` for their real systems, and also don't use
e.g. `ostree commit` on the command line outside of test suites/quick hacking.

This change will also help clarify the role of rpm-ostree, which we will likely
be renamed to "nts". Then use of the term "ostree" will become much clearer. And
similarly for other people writing upgraders, they can say they use libostree.

I didn't try to change all of the docs and code at once, because it's going to
lead to conflicts.

The next big steps are:

  - Rename the github repo (github will inject a redirect)
  - Look at supporting a build where we don't do `ostree admin`, or at least
    it's only built for tests. We may want to split it off as a separate binary
    or so? That way people with their own upgraders don't need to ship it.

Closes: #659
Approved by: jlebon

9 years agotests: Add setup for more realistic repo, change pull-many to use
Colin Walters [Sun, 29 Jan 2017 19:15:17 +0000 (14:15 -0500)]
tests: Add setup for more realistic repo, change pull-many to use

As OSTree has evolved over time, the tests grew with it.  We
didn't start out with static deltas or a summary file, and the
tests reflect this.

What I really want to do is change more of the pull tests, from
corruption/proxying/mirroring etc. to use this more realistic
repo rather than the tiny one the other test creates.

We start by using some of the code from `test-pull-many.sh`, and change that
test to use `--disable-static-deltas` for pull, since the point of that test is
to *not* test deltas.

Still TODO is investigate changing other tests to use this.

Closes: #658
Approved by: jlebon

9 years agolib: Move the bupsplit selftest into our test framework
Colin Walters [Wed, 25 Jan 2017 14:25:27 +0000 (09:25 -0500)]
lib: Move the bupsplit selftest into our test framework

We weren't running it before. Also I switched it to use GLib. Preparation for
some oxidation work (having an implementation of bupsplit in Rust).

I exported another function to do the raw rollsum operation which is what this
test suite uses.

Closes: #655
Approved by: jlebon

9 years agotravis: Disable tests (but keep builds) on flaky distros
Colin Walters [Mon, 30 Jan 2017 10:21:43 +0000 (11:21 +0100)]
travis: Disable tests (but keep builds) on flaky distros

I went through the Travis history a bit, and these seem to be
the flaky ones.  The ubuntu one is likely no libsoup patches.
The other one @smcv has partially traced to a GPGME race condition
or something like that.

For the libsoup one; as I say in comments, once we have libcurl, I'd like to
enable that mostly everywhere, which should (hopefully) be more reliable.

Closes: #664
Approved by: cgwalters

9 years agolib: Prefix GPG errors with the checksum
Colin Walters [Mon, 30 Jan 2017 09:55:22 +0000 (10:55 +0100)]
lib: Prefix GPG errors with the checksum

I was working on https://bugzilla.redhat.com/show_bug.cgi?id=1393545
and it was annoying that I couldn't know what the new (unsigned)
commit has was until verification succeeded.  I could pull it
manually without GPG, but then it'd be sitting in the repo.

Now:

```
Updating from: fedora-atomic:fedora-atomic/25/x86_64/docker-host

Receiving metadata objects: 0/(estimating) -/s 0 bytes
error: Commit 2fb89decd2cb5c3bd73983f0a7b35c7437f23e3aaa91698fab952bb224e46af5: GPG verification enabled, but no signatures found (use gpg-verify=false in remote config to disable)
```

Closes: #663
Approved by: giuseppe

9 years agolib: Adjust comments in symbols section for last release
Colin Walters [Mon, 30 Jan 2017 06:44:20 +0000 (07:44 +0100)]
lib: Adjust comments in symbols section for last release

2017.1 was released, move its section above the line.

Closes: #661
Approved by: cgwalters

9 years agolibostree: Don't distribute generated enumtypes in tarballs
Simon McVittie [Fri, 27 Jan 2017 09:06:39 +0000 (09:06 +0000)]
libostree: Don't distribute generated enumtypes in tarballs

They are built at "make" time and cleaned up by "make clean", so there
is no need to distribute them.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #665
Approved by: cgwalters

9 years agodocs: update pulp_ostree link
Jonathan Lebon [Mon, 23 Jan 2017 00:06:54 +0000 (19:06 -0500)]
docs: update pulp_ostree link

Closes: #657
Approved by: cgwalters

9 years agotrivial-httpd: trivial option help string fixes
Jonathan Lebon [Sat, 14 Jan 2017 19:22:47 +0000 (14:22 -0500)]
trivial-httpd: trivial option help string fixes

Add an arg description for -P, otherwise it's not immediately obvious
that it takes an argument.

Mention that - is supported for --log-file.

Closes: #657
Approved by: cgwalters

9 years agoRelease 2017.1
Colin Walters [Mon, 23 Jan 2017 20:22:30 +0000 (15:22 -0500)]
Release 2017.1

Just bugfixes, but it's time to ship them.

Closes: #653
Approved by: jlebon

9 years agotests: Add a big (many objects) pull
Colin Walters [Wed, 18 Jan 2017 18:35:42 +0000 (13:35 -0500)]
tests: Add a big (many objects) pull

This would be more likely to tickle things like
https://github.com/ostreedev/ostree/issues/601
reliably.

Also, while working on the curl backend, I hit on the fact that curl doesn't
queue (by default, you can enable) and will happily create 20000+ concurrent TCP
connections if you try. Having this test would have made that more likely to
fail.

Closes: #650
Approved by: giuseppe

9 years agoAdd support for more selective pruning
Colin Walters [Thu, 1 Dec 2016 14:28:24 +0000 (09:28 -0500)]
Add support for more selective pruning

There are use cases for having a single repo with branches
with different lifecycles; a simple example of what I was
trying to do in CentOS Atomic Host work is have "stable"
and "devel" branches, were we want to prune devel, but
retain *all* of stable.

This patch is split into two parts - first we add a low level "delete all
objects not in this set" API, and change the current prune API
to use this.

Next, we move more logic into the "ostree prune" command. This paves the way for
demonstrating how more sophisticated algorithms/logic could be developed outside
of the ostree core.

Also, the --keep-younger-than logic already lived in the commandline, so it
makes sense to keep extending it there.

Closes: https://github.com/ostreedev/ostree/issues/604
Closes: #646
Approved by: jlebon

9 years agoMake corrupt-repo-ref.js executable
Simon McVittie [Thu, 19 Jan 2017 11:34:57 +0000 (11:34 +0000)]
Make corrupt-repo-ref.js executable

Debian's Lintian packaging consistency check complains that it isn't
executable but has a #! line. In fact it's reasonable to run this
script directly, so make it executable, and put it in a _scripts
variable so it will be installed executable.

Closes: #652
Approved by: cgwalters

9 years agoSourced test snippets: remove shebang and make non-executable
Simon McVittie [Thu, 19 Jan 2017 11:23:30 +0000 (11:23 +0000)]
Sourced test snippets: remove shebang and make non-executable

They are installed non-executable, which makes Debian's Lintian
packaging consistency check complain that #! is only useful
in executable scripts. But in fact they are not useful to execute
directly (they rely on setup being done in the script that sources
them), so just chmod them -x.

Closes: #652
Approved by: cgwalters

9 years agoFix TAP syntax in test-basic-user.sh, and run it
Simon McVittie [Thu, 19 Jan 2017 11:21:58 +0000 (11:21 +0000)]
Fix TAP syntax in test-basic-user.sh, and run it

In its initial commit, Alexander Larsson wrote

    This works standalone, but unfortunately it breaks in
    gnome-desktop-testing-runner as /tmp doesn't support
    xattrs, so it is not installed atm.

but we now (a) use /var/tmp, and (b) explicitly skip the test if
xattr support is unavailable. So it should be OK to run now.

Closes: #652
Approved by: cgwalters

9 years agolibtest: Enable web server logs
Colin Walters [Fri, 13 Jan 2017 17:29:17 +0000 (12:29 -0500)]
libtest: Enable web server logs

Now that we're daemonizing, it's useful to have the logs.  I
wanted this while debugging cookies.

Closes: #651
Approved by: giuseppe

9 years agotests: Loosen error regexp
Colin Walters [Mon, 9 Jan 2017 01:45:58 +0000 (20:45 -0500)]
tests: Loosen error regexp

libcurl AFAICS doesn't have an API to convert HTTP code :arrow_right: error
string, so let's make the test regexp operate on both.

Closes: #651
Approved by: giuseppe

9 years agotests: Don't inject newline in URL
Colin Walters [Mon, 9 Jan 2017 01:44:20 +0000 (20:44 -0500)]
tests: Don't inject newline in URL

It turns out libsoup strips all whitespace even *inside* a URL. We could do that
for libcurl too but...really, people shouldn't do that. In this test we were
adding the trailing newline into the URL. If someone complains who is using the
libcurl code we can deal with it then.

Closes: #651
Approved by: giuseppe

9 years agofetcher: Rework API to use strings for tls keys/db
Colin Walters [Mon, 9 Jan 2017 15:02:19 +0000 (10:02 -0500)]
fetcher: Rework API to use strings for tls keys/db

This is prep for the libcurl porting. `GTlsCertificate/GTlsDatabase` are
abstract classes implemented in glib-networking for gnutls. curl's APIs take
file paths as strings, so it's easier to work on both if we move the GLib TLS
bits into the libsoup code.

Closes: #651
Approved by: giuseppe

9 years agopull: Fix theoretical checksum collision for metadata fetches
Colin Walters [Thu, 19 Jan 2017 01:56:28 +0000 (20:56 -0500)]
pull: Fix theoretical checksum collision for metadata fetches

I was making some other changes in this code, and noticed that we were adding
checksums without object types into the same hash table for metadata. We should
*never* do this with both metadata content objects, since in theory a content
object could have the same hash as metadata.

I don't actually think it's possible in practice for pure metadata to collide,
since they have different structures, but let's do this anyways since it's
conceptually right.

Closes: #651
Approved by: giuseppe

9 years agotests: Alias assert_not_reached() -> fatal()
Colin Walters [Tue, 17 Jan 2017 15:16:31 +0000 (10:16 -0500)]
tests: Alias assert_not_reached() -> fatal()

We had a lot of copies of the "echo something 1>&2; exit 1" code even though
`assert_not_reached()` was it.  Hence, I think we need a shorter alias for that.

Doing this particularly since I noticed a missing `1` in an `exit 1` call in the
rpm-ostree copy of this.

Closes: #648
Approved by: jlebon

9 years agounlock: Fix description for --hotfix
Colin Walters [Mon, 16 Jan 2017 18:41:20 +0000 (13:41 -0500)]
unlock: Fix description for --hotfix

Came up during an IRC discussion.  The text is accurate but
not very helpful.

Closes: #647
Approved by: dustymabe

9 years ago.dir-locals.el: Standard Emacs indentation config
Colin Walters [Thu, 12 Jan 2017 15:53:57 +0000 (10:53 -0500)]
.dir-locals.el: Standard Emacs indentation config

Better than having it per-file.

Closes: #644
Approved by: jlebon

9 years agotrivial-httpd: Daemonize better
Colin Walters [Thu, 12 Jan 2017 15:02:23 +0000 (10:02 -0500)]
trivial-httpd: Daemonize better

I was trying to debug `test-pull-c`, and typing `Ctrl-C` in gdb
ended up sending `SIGINT` to trivial-httpd as well, killing it.

Daemonize a bit more properly to avoid this. I also followed the standard
`/dev/null` guidelines.

Closes: #643
Approved by: jlebon

9 years agopull: Rework delta superblock fetches to be async
Colin Walters [Tue, 3 Jan 2017 15:45:58 +0000 (10:45 -0500)]
pull: Rework delta superblock fetches to be async

For the pending libcurl port, the backend is a bit more
sensitive to the main context setup.  The delta superblock
fetch here is a synchronous request in the section that's
supposed to be async.

Now, libsoup definitely supports mixing sync and async requests, but it wasn't
hard to help the libcurl port here by making this one async. Now fetchers are
either sync or async.

Closes: #636
Approved by: jlebon

9 years agoSplit trivial-httpd into separate binary
Colin Walters [Fri, 30 Dec 2016 19:18:34 +0000 (14:18 -0500)]
Split trivial-httpd into separate binary

Working on the libcurl backend, I hit the issue that the trivial-httpd program
depends on libsoup. I briefly considered having two versions, but libcurl is
client only, and moreover trivial-httpd is no longer trivial - it has various
features which are used by the test suite extensively.

Hence, what we'll do is build it as a separate binary which links to libsoup,
and use it during the tests. We *also* currently still provide `ostree
trivial-httpd` since some things use it like `rpm-ostree-toolbox` and the
Cockpit tests.

After those are ported to use some other webserver, I plan to add a build-time
option to drop it.

Closes: #636
Approved by: jlebon

9 years agobuild-sys: Minor makefile tweaks
Colin Walters [Thu, 29 Dec 2016 20:57:53 +0000 (15:57 -0500)]
build-sys: Minor makefile tweaks

I'm introducing a new binary in a later patch, and it makes
sense to move more things to be common into the common section.

Also I noticed we were missing an inclusion of common `$(AM_LDFLAGS)`, though
AFAIK this doesn't break anything right now.

Closes: #636
Approved by: jlebon

9 years agofetcher: Split lowlevel API into file/membuf variants
Colin Walters [Wed, 28 Dec 2016 19:43:28 +0000 (14:43 -0500)]
fetcher: Split lowlevel API into file/membuf variants

The previous commit introduced a single low level API - however,
we can do things in a more optimal way for the curl backend if
we drop the "streaming API" variant.  Currently, we only use
it to synchronously splice into a memory buffer...which is pretty
silly when we could just do that in the backend.

The only tweak here is that we have an "add NUL character" flag that is
(possibly) needed when fetching into a membuf.

The code here ends up being better I think, since we avoid the double return
value for the `_finish()` invocation, and now most of the fetcher code (in the
soup case) writes to a `GOutputStream` consistently.

This will again make things easier for a curl backend.

Closes: #636
Approved by: jlebon

9 years agofetcher: Move high level functions into "fetcher-util"
Colin Walters [Fri, 23 Dec 2016 01:34:07 +0000 (20:34 -0500)]
fetcher: Move high level functions into "fetcher-util"

Conceptually these now lay on top of the core API, and don't reference libsoup.
This is preparation for libcurl porting, but it's also just generally better.

Closes: #636
Approved by: jlebon

9 years agofetcher: Hoist core "mirrored request" API to public
Colin Walters [Thu, 22 Dec 2016 22:57:04 +0000 (17:57 -0500)]
fetcher: Hoist core "mirrored request" API to public

This is in preparation for the libcurl port. We're basically making public what
we had internally. The next step here is to create `ostree-fetcher-util.[ch]`
that only operates in terms of this lower level API.

Also drop the `_mirrored` from the function name since it's
the default now.

Closes: #636
Approved by: jlebon

9 years agodocs: Fix ostree.version -> version
Colin Walters [Fri, 23 Dec 2016 14:59:30 +0000 (09:59 -0500)]
docs: Fix ostree.version -> version

I think originally I had envisioned this as `ostree.version`, but at the last
minute we changed it to just `version`. That's what all of the code uses, so
let's fix the docs.

Closes: #638
Approved by: paulvt

9 years agoadmin: Use execlp() to look for systemctl as the shell would
Paul van Tilburg [Wed, 21 Dec 2016 15:39:45 +0000 (15:39 +0000)]
admin: Use execlp() to look for systemctl as the shell would

Closes: #637
Approved by: cgwalters

9 years agorepo: Fix list_objects annotations
Dan Nicholson [Thu, 22 Sep 2016 18:53:19 +0000 (11:53 -0700)]
repo: Fix list_objects annotations

Without the element-type annotations, bindings don't know how to handle
the elements of the hash table. Since the table is created with destroy
functions, the caller does not own the elements, so transfer container
is used.

Closes: #635
Approved by: cgwalters

9 years agorepo: Fix object list keys ownership
Dan Nicholson [Wed, 21 Dec 2016 11:59:08 +0000 (05:59 -0600)]
repo: Fix object list keys ownership

ostree_object_name_serialize returns a floating ref, so sink it before
adding it to the hash table so it can properly be freed later when the
hash table is destroyed.

This is particularly a problem for pygobject, which sinks the refs on
variants as it marshals them to native python types. If the ref isn't
already sunk, then the ref count won't increase and a critical warning
will be raised when both the hash table and pygobject try to unref it.

Closes: #635
Approved by: cgwalters

9 years agorepo: Fix indentation
Dan Nicholson [Wed, 21 Dec 2016 11:58:19 +0000 (05:58 -0600)]
repo: Fix indentation

Closes: #635
Approved by: cgwalters

9 years agostatic-delta: Pretend that world unreadable objects are new objects
Mario Sanchez Prada [Thu, 15 Dec 2016 19:40:18 +0000 (19:40 +0000)]
static-delta: Pretend that world unreadable objects are new objects

This will prevent including in the delta the bits to update files that
are not world readable, so that we don't run into a permissions problem
when applying the deltas from a bare-user repository that has a bare
repository set as its parent.

This is the case for Endless when updating flatpak runtimes, as the
temporary directory created in ~/.local/share/flatpak/system-cache will
be of type bare-user with its parent set to /var/lib/flatpak which is a
bare repository in EOS, as it's shared with the one at /ostree/repo.

https://phabricator.endlessm.com/T14159

Closes: #634
Approved by: cgwalters

9 years agoRelease 2016.15
Colin Walters [Mon, 12 Dec 2016 16:54:03 +0000 (11:54 -0500)]
Release 2016.15

Closes: #632
Approved by: jlebon

9 years agoci: Rebase to f25
Colin Walters [Mon, 12 Dec 2016 14:05:06 +0000 (09:05 -0500)]
ci: Rebase to f25

This is now the devel target, plus I think this may fix some of the
ASAN issues I'm seeing; I mostly have been using f25 for local
testing.

Also remove the MAINTAINER line since the maintainers are defined by
`git log`.

Closes: #631
Approved by: jlebon

9 years agolib: Squash last use of GFile deltas_dir
Colin Walters [Fri, 9 Dec 2016 04:05:39 +0000 (23:05 -0500)]
lib: Squash last use of GFile deltas_dir

I was having this thought today about making more of the OS readonly,
and ultimately if we got to the point where all ostree operations are
through the repo and sysroot dfds, we could have rpm-ostree be the
only process holding those fds open, and have a read-only bind mount
on top.

Anyways, we're not there, likely won't be soon, but this gets us
closer to being fully fd relative.

Closes: #628
Approved by: jlebon

9 years agoci: Combine UBSAN and ASAN by default
Colin Walters [Thu, 8 Dec 2016 02:26:43 +0000 (21:26 -0500)]
ci: Combine UBSAN and ASAN by default

I only recently realized this was possible.  While we're still seeing
leaks in the CI environment for some reason, adding ASAN gives us
use-after-free detection etc., which is obviously still very useful
even if we're not doing leak checking.

Closes: #622
Approved by: jlebon

9 years agoci: Drop sudo installed tests
Colin Walters [Thu, 8 Dec 2016 18:35:29 +0000 (13:35 -0500)]
ci: Drop sudo installed tests

This conflicts with the ASAN work...and in general, I think I'd like
to make a new format for tests that require root, and have them be
defined to be in mutable containers or VMs.

Our coverage loss from this isn't much because some of these tests
already required `CAP_SYS_ADMIN` which we didn't have in Docker
anyways.

While we have the patient open, parallelize the regular installed
tests.

Closes: #622
Approved by: jlebon

9 years agotests: Tweak installed tests to deal with ASAN
Colin Walters [Thu, 8 Dec 2016 17:50:20 +0000 (12:50 -0500)]
tests: Tweak installed tests to deal with ASAN

We need to disable readdir-rand there too.

Closes: #622
Approved by: jlebon

9 years agoSkip gjs-based tests if ASAN is enabled
Colin Walters [Thu, 8 Dec 2016 02:59:40 +0000 (21:59 -0500)]
Skip gjs-based tests if ASAN is enabled

Unfortunately, introspection uses dlopen(), which doesn't quite
work when the DSO is compiled with ASAN but the outer executable
isn't.

Trying to inject LD_PRELOAD=libasan means the outer executable has to
be leak free...which, yeah, I'm not going to get into running ASAN
today on gjs or pygobject.

So, let's skip those tests - ideally, we still run them in some other
context without the sanitizers.  The coverage we have from them is
middling anyways.

Closes: #622
Approved by: jlebon

9 years agorepo: Add unconfigured-state to remote config options
Colin Walters [Thu, 8 Dec 2016 19:20:19 +0000 (14:20 -0500)]
repo: Add unconfigured-state to remote config options

This is a migration from the origin version.  It's
nicer to have it in the remote, since that's what one
needs to change.  Then tools don't need to mess with
the origin file.o

In fact in this scenario one can keep the "media source" like
`file:///install/repo` or whatever, since conceptually that's where it
came from.  We're just providing a better error.

Closes: https://github.com/ostreedev/ostree/issues/626
Closes: #627
Approved by: jlebon

9 years agobuild: Error if glib isn't found
Colin Walters [Thu, 8 Dec 2016 18:38:49 +0000 (13:38 -0500)]
build: Error if glib isn't found

This is a bit extracted from my work on ASAN.

Closes: #625
Approved by: jlebon

9 years agorepo: Fix annotations for remote_fetch_summary functions
Dan Nicholson [Fri, 9 Dec 2016 12:37:47 +0000 (06:37 -0600)]
repo: Fix annotations for remote_fetch_summary functions

These are out parameters, so add the (out) annotation and switch
(nullable) to (optional) since the latter is used for the purpose of
optional out parameters.

Closes: #629
Approved by: cgwalters

9 years agotree-wide: Switch to autoptr for GOptionContext
Colin Walters [Thu, 8 Dec 2016 15:32:09 +0000 (10:32 -0500)]
tree-wide: Switch to autoptr for GOptionContext

We were leaking in a few places that I noticed in an ASAN run.  Also,
this was one of the last non-autoptr cleanup sections we have in
`out:` cleanup sections, making us a lot closer to a potential
full-tree rewrite to `return FALSE`.

Closes: #624
Approved by: jlebon

9 years agobuild: Always do enum scanning now
Colin Walters [Thu, 8 Dec 2016 02:00:21 +0000 (21:00 -0500)]
build: Always do enum scanning now

Since we stopped including the libsoup headers in `ostree-fetcher.h`,
we can now unconditionally do enum scanning, and drop a build time
conditional.

Prep for libcurl porting.

Closes: #620
Approved by: jlebon

9 years ago[ASAN] sysroot: Squash a leak in lockfile acquisition
Colin Walters [Thu, 8 Dec 2016 15:01:35 +0000 (10:01 -0500)]
[ASAN] sysroot: Squash a leak in lockfile acquisition

I installed `parallel` in my dev container, which got me
the sysroot locking tests, which caught this leak when
built with ASAN.

Closes: #623
Approved by: jlebon

9 years agobuild: Make libsoup optional again
Colin Walters [Thu, 8 Dec 2016 02:16:52 +0000 (21:16 -0500)]
build: Make libsoup optional again

The "remote cookies" code broke this.  While I'm not sure anyone is
actually using ostree-without-http, it isn't too hard to keep the
build time conditional going.  Further, this work is preparatory for
libcurl porting.

Closes: #621
Approved by: jlebon

9 years agofetcher: Define an abstraction over SoupURI
Colin Walters [Tue, 6 Dec 2016 16:34:05 +0000 (11:34 -0500)]
fetcher: Define an abstraction over SoupURI

This is preparatory work for a potential libcurl backend.

Closes: #616
Approved by: jlebon

9 years agolib: Ensure we use _GNU_SOURCE in enum templates
Colin Walters [Tue, 6 Dec 2016 16:30:19 +0000 (11:30 -0500)]
lib: Ensure we use _GNU_SOURCE in enum templates

Due to the way glib-mkenums runs the preprocessor itself, it
doesn't pick up the `AC_USE_SYSTEM_EXTENSIONS()` that we have in
`configure.ac`.

This blew up in an obscure way when I later wanted to `#include
"libglnx.h"` in one of the headers, since it needs the `basename()`
from `string.h` which is only available with `_GNU_SOURCE`.

Closes: #616
Approved by: jlebon

9 years agobuild: Add more default errors
Colin Walters [Wed, 7 Dec 2016 14:55:10 +0000 (09:55 -0500)]
build: Add more default errors

Newer gcc has `-Wincompatible-pointer-types`, hooray!
Add a few others that we pass today.

Closes: #618
Approved by: jlebon

9 years agoci: Make all ci tests gating for Homu
Colin Walters [Tue, 6 Dec 2016 21:29:39 +0000 (16:29 -0500)]
ci: Make all ci tests gating for Homu

See the rhci docs.

Closes: #617
Approved by: jlebon

9 years agotree-wide: Use g_hash_table_add() where applicable
Colin Walters [Tue, 6 Dec 2016 02:06:43 +0000 (21:06 -0500)]
tree-wide: Use g_hash_table_add() where applicable

Just noticed a few while reading some code, decided to do a quick
cleanup.  It's shorter and clearer.

Closes: #614
Approved by: jlebon

9 years agolib: Remove unused ostree_metalink_get_uri()
Colin Walters [Tue, 6 Dec 2016 03:04:06 +0000 (22:04 -0500)]
lib: Remove unused ostree_metalink_get_uri()

While doing something else I noticed it was unused.

Closes: #615
Approved by: jlebon

9 years agopull: Write .commitpartial for local pulls first too
Colin Walters [Tue, 6 Dec 2016 01:56:55 +0000 (20:56 -0500)]
pull: Write .commitpartial for local pulls first too

This is what we do for non-local (i.e. HTTP) pulls; we wnat to
correctly handle being interrupted during partial pulls.

Closes: https://github.com/ostreedev/ostree/issues/579
Closes: #613
Approved by: jlebon

9 years agolib: Always checksum content in deltas
Colin Walters [Mon, 5 Dec 2016 22:22:46 +0000 (17:22 -0500)]
lib: Always checksum content in deltas

This is a follow up to conversation on list - in practice, if we're
backing away from summary signing, then it makes sense to remove the
special casing for checksums in deltas around summary signatures.

This is also related to the recent change to enable GPG checking for
commits in deltas - now we have a more coherent story between the
previous pull path and deltas.

I didn't do any performance checking, and while it's slightly annoying
that we're now doing sha256 on the delta content twice (once for the
part and once per object)...sha256 is pretty fast, I think most users
are I/O bound anyways, and it'd drop even farther if we started using
openssl.

Closes: #612
Approved by: jlebon

9 years agotests/keyfile-utils: Drop tests covering preconditions
Colin Walters [Mon, 5 Dec 2016 18:08:39 +0000 (13:08 -0500)]
tests/keyfile-utils: Drop tests covering preconditions

The spam in stderr was bothering me, and further at some eventual
point in the future we want to annotate the functions with
`__attribute__((nonnull))` which would then cause tests like these to
become undefined behavior.

The coverage of this isn't worth the log spam basically.

Closes: #611
Approved by: jlebon

9 years agotests: Use G_DEBUG=fatal-warnings here too
Colin Walters [Mon, 5 Dec 2016 17:58:43 +0000 (12:58 -0500)]
tests: Use G_DEBUG=fatal-warnings here too

I am trying to track down a warning I see in `test-keyfile-utils`
which turned out to be the installed case only, but let's inject
this here too.

(The GLib default is broken, but it's hard to fix upstream without
 breaking the world)

Closes: #610
Approved by: jlebon

9 years ago[ASAN] tests: Cleanup all current remaining leaks
Colin Walters [Fri, 2 Dec 2016 18:45:04 +0000 (13:45 -0500)]
[ASAN] tests: Cleanup all current remaining leaks

We now run fully through ASAN here.

Closes: #609
Approved by: jlebon

9 years agoDefine and use cleanup helpers for libarchive
Colin Walters [Fri, 2 Dec 2016 18:34:32 +0000 (13:34 -0500)]
Define and use cleanup helpers for libarchive

This should fix some of the ASAN leaks around libarchive usage,
and is generally better.

Closes: #609
Approved by: jlebon

9 years agoTerminate individual tests after (10 * $TEST_TIMEOUT_FACTOR) minutes
Simon McVittie [Thu, 1 Dec 2016 16:28:27 +0000 (16:28 +0000)]
Terminate individual tests after (10 * $TEST_TIMEOUT_FACTOR) minutes

While using the Automake parallel test harness, if a test hangs for
long enough for an external watchdog to kill the entire build process
(as happens in Debian sbuild after 150 minutes with no activity on
stdout/stderr), the logs will not be shown. If we make an individual
test time out sooner, logs are more likely to be shown.

We use SIGABRT so that the process(es) under test will dump core,
allowing the point at which ostree is blocking to be analyzed.
After 1 minute, if any have not died, we kill them again with SIGKILL.

To support slow platforms and slow debugging tools, if
TEST_TIMEOUT_FACTOR is set, multiply the 10 minute timeout by that.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #607
Approved by: cgwalters

9 years agotests: prepend to an existing LD_LIBRARY_PATH, GI_TYPELIB_PATH
Simon McVittie [Wed, 30 Nov 2016 10:01:05 +0000 (10:01 +0000)]
tests: prepend to an existing LD_LIBRARY_PATH, GI_TYPELIB_PATH

If we're using LD_LIBRARY_PATH for some locally-built library, we want
to search those after OSTree's own libraries.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #606
Approved by: cgwalters

9 years ago[ASAN] tests: Fix leaks
Colin Walters [Tue, 29 Nov 2016 03:03:53 +0000 (22:03 -0500)]
[ASAN] tests: Fix leaks

Just for cleaner sanitizer output.

Closes: #598
Approved by: jlebon

9 years ago[ASAN] set-origin: Squash a leak
Colin Walters [Tue, 29 Nov 2016 03:03:24 +0000 (22:03 -0500)]
[ASAN] set-origin: Squash a leak

Just a minor leak in the commandline.

Closes: #598
Approved by: jlebon

9 years ago[ASAN] bootconfig: Drop a pointless strdup in parser
Colin Walters [Tue, 29 Nov 2016 03:02:42 +0000 (22:02 -0500)]
[ASAN] bootconfig: Drop a pointless strdup in parser

Not entirely sure how this was leaking, but anyways it showed
up in ASAN, and it's pointless to strdup here.

Closes: #598
Approved by: jlebon

9 years ago[ASAN] metalink: Fix leaks of buffer
Colin Walters [Tue, 29 Nov 2016 03:01:33 +0000 (22:01 -0500)]
[ASAN] metalink: Fix leaks of buffer

We should be religious about the "only set output variables on
success", otherwise it makes leaks more likely.

But the real leak was us simply not using autoptr in one place.

Closes: #598
Approved by: jlebon

9 years ago[ASAN] sysroot: Fix leak/double free of keyfile origin
Colin Walters [Tue, 29 Nov 2016 03:00:01 +0000 (22:00 -0500)]
[ASAN] sysroot: Fix leak/double free of keyfile origin

Use autoptr rather than manual cleanup.  The double free isn't a
security problem, since we trust origin files.

Closes: #598
Approved by: jlebon

9 years agotraverse: Use g_hash_table_add
Colin Walters [Tue, 29 Nov 2016 02:14:47 +0000 (21:14 -0500)]
traverse: Use g_hash_table_add

And "move semantics" via `g_steal_pointer()`.  Just a minor code
cleanup I noticed when I was hunting for a leak, which ended up being
elsewhere.

Closes: #598
Approved by: jlebon

9 years ago[ASAN] cmdline: Fix minor leak in delta cmdline entrypoint
Colin Walters [Tue, 29 Nov 2016 02:12:53 +0000 (21:12 -0500)]
[ASAN] cmdline: Fix minor leak in delta cmdline entrypoint

Small, but it's important to stay clean.

Closes: #598
Approved by: jlebon

9 years ago[ASAN] deltas: Fix minor memory leak
Colin Walters [Tue, 29 Nov 2016 02:12:23 +0000 (21:12 -0500)]
[ASAN] deltas: Fix minor memory leak

We were leaking the checksum, ensure we free it in both normal and
error paths.

Closes: #598
Approved by: jlebon

9 years ago[ASAN] delta compilation: More leak fixes
Colin Walters [Tue, 29 Nov 2016 02:11:37 +0000 (21:11 -0500)]
[ASAN] delta compilation: More leak fixes

Now that I remembered to do `env G_SLICE=always-malloc`, lots more
leaks become apparent.  Nothing major.

Closes: #598
Approved by: jlebon

9 years agoman: Mention bare-user in manpages, along with the other modes
Mario Sanchez Prada [Wed, 30 Nov 2016 15:41:38 +0000 (15:41 +0000)]
man: Mention bare-user in manpages, along with the other modes

Closes: #602
Closes: #603
Approved by: cgwalters

9 years agotravis-ci: document parameter variables
Simon McVittie [Tue, 29 Nov 2016 13:06:14 +0000 (13:06 +0000)]
travis-ci: document parameter variables

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Closes: #600
Approved by: cgwalters

9 years agotravis-ci: Enable stretch (the future Debian 9), replacing unstable
Simon McVittie [Mon, 28 Nov 2016 17:27:44 +0000 (17:27 +0000)]
travis-ci: Enable stretch (the future Debian 9), replacing unstable

My goal in building ostree for Debian unstable was that we would
have good coverage of "new code" paths. However, it was removed
for #571 as too much of a moving target. Debian testing is less of
a moving target, and in particular is always internally consistent
(packages are co-installable), which Debian unstable is not guaranteed
to be.

Debian 'stretch' is the future Debian 9, which should be released
next year.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Closes: #600
Approved by: cgwalters

9 years agotravis-ci: Use "slim" Debian image for testing
Simon McVittie [Mon, 28 Nov 2016 17:24:55 +0000 (17:24 +0000)]
travis-ci: Use "slim" Debian image for testing

Documentation and similar files are stripped from this image, making
it quicker to install.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Closes: #600
Approved by: cgwalters

9 years agotravis-ci: Run `make distcheck` too
Simon McVittie [Mon, 28 Nov 2016 17:24:08 +0000 (17:24 +0000)]
travis-ci: Run `make distcheck` too

ostree is now actively using that mode.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Closes: #600
Approved by: cgwalters

9 years agotravis-ci: cat the test log after successful test runs
Simon McVittie [Mon, 28 Nov 2016 17:23:43 +0000 (17:23 +0000)]
travis-ci: cat the test log after successful test runs

This lets us see which tests were skipped.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Closes: #600
Approved by: cgwalters

9 years agotravis-ci: Move helper function to before we start building anything
Simon McVittie [Mon, 28 Nov 2016 17:23:08 +0000 (17:23 +0000)]
travis-ci: Move helper function to before we start building anything

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Closes: #600
Approved by: cgwalters

9 years agotravis-ci: Use a non-ostree-specific name for the Docker image
Simon McVittie [Mon, 28 Nov 2016 17:22:24 +0000 (17:22 +0000)]
travis-ci: Use a non-ostree-specific name for the Docker image

This reduces the diff when comparing these scripts with similar glue
in dbus or elsewhere.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Closes: #600
Approved by: cgwalters

9 years agotravis-ci: put an explicit copyright/license on the scripts
Simon McVittie [Mon, 28 Nov 2016 17:21:46 +0000 (17:21 +0000)]
travis-ci: put an explicit copyright/license on the scripts

This is deliberately permissive: a lot of it is generic, and I'm
using similar scripts in dbus.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Closes: #600
Approved by: cgwalters

9 years agoci-install: add ci_distro
Simon McVittie [Tue, 29 Nov 2016 13:05:57 +0000 (13:05 +0000)]
ci-install: add ci_distro

Otherwise, we'll fail (due to set -u) if this parameter variable isn't
passed.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Closes: #600
Approved by: cgwalters

9 years agoci-build: consistently use yes/no for booleans, not yes/empty
Simon McVittie [Mon, 28 Nov 2016 12:34:06 +0000 (12:34 +0000)]
ci-build: consistently use yes/no for booleans, not yes/empty

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Closes: #600
Approved by: cgwalters

9 years agobuild: clean up ostree-remount if building without systemd
Simon McVittie [Mon, 28 Nov 2016 19:05:53 +0000 (19:05 +0000)]
build: clean up ostree-remount if building without systemd

This is necessary for "make distcheck" on Travis-CI.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Closes: #600
Approved by: cgwalters

9 years agodelta compilation: Fix leak
Alexander Larsson [Mon, 28 Nov 2016 16:21:59 +0000 (17:21 +0100)]
delta compilation: Fix leak

We need to ref-sik the new varian for g_autoptr to work

Closes: #597
Approved by: cgwalters

9 years agopull: Don't leak delta superblock variants
Alexander Larsson [Mon, 28 Nov 2016 14:57:11 +0000 (15:57 +0100)]
pull: Don't leak delta superblock variants

Closes: #596
Approved by: cgwalters

9 years agopull_with_options: Don't leak csum_v
Alexander Larsson [Mon, 28 Nov 2016 14:56:50 +0000 (15:56 +0100)]
pull_with_options: Don't leak csum_v

Closes: #596
Approved by: cgwalters

9 years agoostree-repo-traverse: Don't leak floating GVariant
Alexander Larsson [Mon, 28 Nov 2016 14:31:04 +0000 (15:31 +0100)]
ostree-repo-traverse: Don't leak floating GVariant

ostree_object_name_serialize returns a floating ref, so we need
to sink it before putting in the hashtable.

Closes: #595
Approved by: cgwalters

9 years agopull: scan_commit_object() - don't load variant twice
Alexander Larsson [Mon, 28 Nov 2016 12:58:19 +0000 (13:58 +0100)]
pull: scan_commit_object() - don't load variant twice

ostree_repo_load_commit already loaded the object, no need
to load it twice.

Closes: #595
Approved by: cgwalters

9 years agoostree-repo-traverse: Remove an accidental print statement
Jasper St. Pierre [Wed, 23 Nov 2016 21:52:39 +0000 (13:52 -0800)]
ostree-repo-traverse: Remove an accidental print statement

Closes: #594
Approved by: jlebon

9 years agoRelease 2016.14
Colin Walters [Wed, 23 Nov 2016 15:42:39 +0000 (10:42 -0500)]
Release 2016.14

Closes: #593
Approved by: jlebon

9 years agoFix broken link in docs/CONTRIBUTING.md
Abhay Kadam [Tue, 22 Nov 2016 13:04:52 +0000 (18:34 +0530)]
Fix broken link in docs/CONTRIBUTING.md

The link for git-rebase manual contains stray character (])
at the end.

Closes: #592
Approved by: jlebon